import React, { Component } from 'react'

export default class AxiosCpm extends Component {

    state = {
        list: []
    }

    async componentDidMount () {
        let res = await fetch('http://localhost:3000/assets').then(res => res.json())

        console.log(res)
        this.setState({
            list: res
        })
    }



    render () {

        console.log('render')
        return (

            <>
                <div>AxiosCpm</div>
                <ul>
                    {
                        this.state.list.length > 0 && this.state.list.map(item => {
                            return (
                                <li key={item.id}>   名字：{item.name}----- {item.price}</li>
                            )
                        })
                    }

                </ul>

            </>


        )



    }
}



